import java.io.*;
import java.util.*;


public class master {
	
	private ArrayList sns=new ArrayList<sn_node>(); //list of sn nodes where all sn nodes are stored
	private int numOfSNs;
	private int rangeOfSNs;
	//other things like lists of x locations, energy etc
	public master(){
		//calls readFromFile to get file data and puts into the class variables
		//interprets arraylist from readfromfile and stores peices in appropriate vars;
	}
	// main thread (CN), currently testing thread stuff
	public static void main(String[] args) {
		
		/*
		 * sn_node n;
		testNode thr1, thr2;
		
		testNode tn1 = new testNode(1,2);
		testNode tn2 = new testNode(3,4);
		Thread t1 = new Thread(tn1);
		Thread t2 = new Thread(tn2);
		t1.start();
		t2.start();
		*/

		//loop and call to deploysensor
	}


	public ArrayList readFromFile(){
		File f= new File("file.in");
		ArrayList<String> linesOfFile=new ArrayList<String>();
		try{
			Scanner s=new Scanner(f);
			while(s.hasNextLine()){
				
			}

		}catch(FileNotFoundException e){
			System.err.println("input FileNotFoundException");
		}
		return linesOfFile;
	}
	
		//printAll, gets distance to cn, and shortest hop to nextnode from all sn_nodes
	public void PrintAll(){
		ArrayList distanceToCN,shortestHopToNextNode;
		for(int i=1;i<this.numOfSNs; i++){
			//code that gets the dist to cn and shortest hop from each cn and puts it in arraylist
			//call to helper for printing this stuff
		}
	}
	
	private void PrintAllHelper(ArrayList distanceToCN, ArrayList shortestHopToNextNode){
		
		
		// ArrayList can be any data type, doesnt need to be arraylist specifically
		
		Iterator dtcnIter=distanceToCN.iterator();
		Iterator shthopIter=shortestHopToNextNode.iterator();
		try{

			FileWriter fw = new FileWriter("372Project.out");
			PrintWriter out = new PrintWriter(fw);
			out.println("A");
			while(dtcnIter.hasNext()){
				out.print(dtcnIter.next()+" ");
			}
			out.println("");//next line
			while(shthopIter.hasNext()){
				out.print(shthopIter.next()+" ");
			}
			out.println(""); //blank line at the end of the list	
			out.close();
				
		}catch(Exception e){
			System.err.println("red text");
		}
	}
}
